import { VideoExchangeBase } from "./Sheets"
import { SheetManager } from "../../ccc3-framework-core/framework/modules/sheetManager";
export class VideoExchange extends VideoExchangeBase {
  //id索引
  public static get(id: any) {
    if ((this as any)[id]) return (this as any)[id];
    return SheetManager.get("VideoExchange", id, VideoExchange);
  }

  public static getAll() {
    return SheetManager.getAllSheets("VideoExchange", VideoExchange);
  }

  public static getExchangeDollar(level: number) {
    let item: VideoExchange = this.get(level);
    if (!item) {
      let all = this.getAll().sort((a: VideoExchange, b: VideoExchange) => b.id - a.id);
      item = all[0];
    }
    return item.dollar
  }
}